package com.ynkbny.util;

public class ResultUtils {

    // 状态码
    private Integer status;
    // 状态码
    private String message;
    // 响应的数据
    private Object data;

    // 成功
    public static ResultUtils success(RespStaticEnum respStaticEnum){
        ResultUtils result = new ResultUtils();
        result.setStatus(respStaticEnum.getStatus());
        result.setMessage(respStaticEnum.getMsg());
        result.setData(null);
        return result;
    }

    // 成功
    public static ResultUtils success(RespStaticEnum respStaticEnum, Object obj){
        ResultUtils result = new ResultUtils();
        result.setStatus(respStaticEnum.getStatus());
        result.setMessage(respStaticEnum.getMsg());
        result.setData(obj);
        return result;
    }

    // 失败
    public static ResultUtils fail(RespStaticEnum respStaticEnum){
        ResultUtils result = new ResultUtils();
        result.setStatus(respStaticEnum.getStatus());
        result.setMessage(respStaticEnum.getMsg());
        return result;
    }

    // 失败
    public static ResultUtils fail(RespStaticEnum respStaticEnum, Object obj){
        ResultUtils result = new ResultUtils();
        result.setStatus(respStaticEnum.getStatus());
        result.setMessage(respStaticEnum.getMsg());
        result.setData(obj);
        return result;
    }


    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}